#define _CRT_SECURE_NO_WARNINGS 1

#define MAXSIZE 10 
#include <stdio.h>
#include <stdlib.h>

typedef struct
{
	int* elem;
	int* before;
	int length;
}Sqlist;

void Init(Sqlist &L)
{
	L.elem = (int*)malloc(sizeof(int)* MAXSIZE);
	L.before = (int*)malloc(sizeof(int)* MAXSIZE);
	if (!L.elem||!L.before)
		return;
	L.length = 0;
}

void get_num(Sqlist &L,int n)
{
	int input = 0;
	int i = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &input);
		L.elem[i] = input;
		L.before[i] = input;
		L.length++;
	}
}

int insert(Sqlist &L,int local,int value)
{
	if (local<1 || local>L.length + 1)
	{
		return 0;
	}
	if (L.length == MAXSIZE)
	{
		return 1;
	}
	int i = 0;
	for (i = L.length-1; i >= local-1; i--)
	{
		L.elem[i + 1] = L.elem[i];
	}
	L.elem[local - 1] = value;
	L.length++;
	return 2;
}

void print(Sqlist L,int n,int x)
{
	printf("Before:(%d",L.before[0]);
	for (int i = 1; i < n; i++)
	{
		printf(",%d", L.before[i]);
	}
	printf(")\n");
	if (x == 0)
	{
		printf("Insert position error!");
		return;
	}
	if (1 == x)
	{
		printf("OVERFLOW!");
		return;
	}
	printf("After:(%d", L.elem[0]);
	for (int j = 1; j < L.length; j++)
	{
		printf(",%d", L.elem[j]);
	}
	printf(")\n");
}

int main()
{
	int n = 0;
	Sqlist L;
	scanf("%d", &n);
	Init(L);
	get_num(L, n);
	int local = 0;
	int value = 0;
	scanf("%d %d", &local, &value);
	int x = insert(L, local, value);
	print(L, n,x);
	return 0;
}